package com.example.studyPlatform.config;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FilterConfig {
    ThemeConfig themeConfig;

    public FilterConfig(ThemeConfig themeConfig) {
        this.themeConfig = themeConfig;
    }

    @Bean
    public FilterRegistrationBean registerFilter() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(themeConfig);
        registration.addUrlPatterns("/theme/*");
        registration.setName("themeResourceRouter");
        registration.setOrder(1);
        return registration;
    }
}
